/**
 * 工具函数
 */
export const numberFormat = function(value) {
  if (!value) return "0";
  var param = {
    percent: value < 0 ? "-" : ""
  };
  value = String(value).replace(/-/g, "");
  var k = 10000,
    sizes = ["", "万", "亿", "万亿"],
    i;
  if (value < k) {
    param.value = value;
    param.unit = "";
  } else {
    i = Math.floor(Math.log(value) / Math.log(k));

    param.value = (value / Math.pow(k, i)).toFixed(2);
    param.unit = sizes[i];
  }
  return `${param.percent + param.value + param.unit}`;
};
